﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MediaDataModel;

namespace WaterMarkerApp
{
    public partial class BaseForm : Form
    {
        #region private properties

        protected bool formMove = false;

        protected Point formPoint;

        protected User loginUser = null;

        public static string MessageBoxCaption = "消息提示";

        #endregion

        public BaseForm()
        {
            InitializeComponent();
        }


        #region Events

        private void BaseFormcs_Load(object sender, EventArgs e)
        {

        }

        protected void pnlMainForm_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)//按下的是鼠标左键
            {
                formMove = false;//停止移动
            }
        }

        protected void pnlMainForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (formMove == true)
            {
                Point mousePos = Control.MousePosition;
                mousePos.Offset(formPoint.X, formPoint.Y);
                Location = mousePos;
            }
        }

        protected void pnlMainForm_MouseDown(object sender, MouseEventArgs e)
        {
            formPoint = new Point();
            int xOffset;
            int yOffset;
            if (e.Button == MouseButtons.Left)
            {
                xOffset = -e.X - SystemInformation.FrameBorderSize.Width;
                yOffset = -e.Y - SystemInformation.FrameBorderSize.Height;//SystemInformation.CaptionHeight -
                formPoint = new Point(xOffset, yOffset);
                formMove = true;//开始移动
            }
        }

        #endregion

        #region private methods

        #endregion


    }
}
